<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>问题处理</title>
	
<link rel="stylesheet" type="text/css" href="../../themes/general.css"  />
<link rel="stylesheet" type="text/css" href="../../themes/icon.css" 			/>
<link rel="stylesheet" type="text/css" href="../../themes/jquery-ui.css" 		/>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css" 	/>
<script type="text/javascript" src="../../scripts/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../../scripts/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../../scripts/src/jquery.parser.js"></script>
<script type="text/javascript" src="../../scripts/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../../scripts/sessionExpriation.js"></script>
<script type="text/javascript" src="../../scripts/general.js"></script>

<style type="text/css">	
#findDate{
	border: 1px solid #95B8E7;
	border-radius: 5px 5px 5px 5px;
	height: 25px;
}
#rectifyDate{
		border: 1px solid #95B8E7;
	border-radius: 5px 5px 5px 5px;
	height: 25px;
}
</style>
<script type="text/javascript">
	$(function() {
		var projectId = $.getUrlParam('projectId');
		//表单提交ajax
		$('#new_form').form({
			url : '../../question/addQuestion.ajax?proId=' + projectId,
			onSubmit : function() {							
				if ($(this).form('validate')) {
					return true;
				} else {
					return false;
				}
			},
			success : function(data) {
				var obj = $.parseJSON(data);//将json字符串转换为object对象
				if (obj.success) {
					$.messager.alert('提示', obj.message, 'info', function(){
						location.reload();//强迫浏览器刷新当前页面
					});
				} else {
					$.messager.alert('错误', obj.message, 'error');
				}
			}
		});
		//显示项目名称的ajax
		$.ajax({
			url : '../../XXX.ajax',
			type : 'post',
			dataType : 'JSON',
			cache: false,
			data : {
				msgId : projectId,
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) {	                    
	        },
			success : function(data) {			
				$('#projectName').text(data.projectName);//待修改，这里是在页面最开始填入项目名称的
			}
		});

		//事件绑定，点击提交就提交表单
		$('#btn_submit').bind('click', function() {
			$("#new_form").submit();
		});	
		//发现问题的日期
		$('#findDate').datebox({
			onSelect: function(date){
				var entrustDate = $('#findDate').datebox('getValue');
				var endDate = $('#rectifyDate').datebox('getValue');
				
				if(Date.parse(endDate) - Date.parse(entrustDate)<=0){
					$.messager.alert('错误', '解决日期必须晚于发现日期', 'error');
					$('#findDate').datebox('setValue', '');	
				} 
			},
			required:true
		});

		//结束日期 使用databox 主要是判断注册日期是否大于现在的日期
		$('#rectifyDate').datebox({
			onSelect: function(date){
				var endDate = $('#rectifyDate').datebox('getValue');
				var startDate = $('#findDate').datebox('getValue');
				/*if(compareDate(endDate) <= 0){
					$.messager.alert('错误', '结束日期必须晚于当前日期', 'error');
					$('#rectifyDate').datebox('setValue', '');	
				} 
				else*/ if (Date.parse(endDate) - Date.parse(startDate)<=0) {
					$.messager.alert('错误', '结束日期必须晚于开始日期', 'error');
					$('#rectifyDate').datebox('setValue', '');
				}
			},
			required:true
		});	
	});	
	</script>
</head>

<body>
<form id="new_form" method="post" enctype="multipart/form-data">
	<input type="hidden" name="projectId"   		id="projectId" 	value="" />
	<input type="hidden" name="fileName_total" 	id="fileName_total" value="" />
	<span>子项目名称：</span><span id="projectName"></span>
	<table class="table_new">
		<tr>
			<td class="td_new_subtitle" colspan="2" ><strong>发现问题</strong></td>
		</tr>
		<tr>
			<td class="td_new_name">发现时间<span class="red">*</span></td>
			<td class="td_new_value">
				<input type="text" name="findTime" id="findDate" /></td>			
		</tr>
		<tr>
			<td class="td_new_name">问题概述<span class="red">*</span></td>
			<td class="td_new_value"><textarea name="quesDescription" id="productServiceDesc" style="height: 60px" cols="105" data-options="required:true,validType:'length[2,200]'" class="easyui-validatebox"></textarea></td>
		</tr>
		<tr>
			<td class="td_new_name">不符合依据<span class="red">*</span></td>
			<td class="td_new_value"><textarea name="quesNoSuitBasis" id="productServiceDesc" style="height: 60px" cols="105" data-options="required:true,validType:'length[2,200]'" class="easyui-validatebox"></textarea></td>
		</tr>
		<tr>
			<td class="td_new_name">整改时间<span class="red">*</span></td>
			<td class="td_new_value">
				<input type="text" name="updateTime" id="rectifyDate" /></td>
		</tr>
		<tr>
			<td class="td_new_name">整改过程概述<span class="red">*</span></td>
			<td class="td_new_value"><textarea name="updateProcessDescription" id="productServiceDesc" style="height: 60px" cols="105" data-options="required:true,validType:'length[2,200]'" class="easyui-validatebox"></textarea></td>
		</tr>
	</table>
	</br>
	<table class="table_new">
	<tr>
		<td align="center" width="100%"><a id="btn_submit" href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok">确认提交</a></td>
	</tr>
	</table>
	
</form>

</body>
</html>